// Evol scripts.
// Authors:
//    Reid
//    Travolta
// Description:
//    La Johanne crew member.

001-1,193,109,0	script	Devis#001-1	NPC_DEVIS_ARTIS,{

    function say_random_greeting {
        .@enora = getq(ArtisQuests_Enora);
        if (.@enora == 0)
        {
            speech
                l("Enora, from the Legion of Aemil, has been warned that you were aboard."),
                l("She is waiting for you on the dock.");

            return;
        }

        .@rand = rand (5);
        if (.@rand == 0) goodbye;
        else if (.@rand == 1)
        {
            speech 4,
                l("A sunny and hot day,"),
                l("a quiet place,"),
                l("a ground!"),
                l("What else do you need?");
        }
        else if (.@rand == 2) npctalk3 l("A-hoy matey!");
        else if (.@rand == 3) npctalk3 l("We are glad captain Nard has let you join the crew!");
        else if (.@rand == 4) npctalk3 l("Howdy?");

        return;
    }

    function face_to_PC {
        getmapxy(.@map$, .@cx, .@cy, 0);
        @Devis_old_dir = .dir;
        npc_turntoxy(.@cx, .@cy);

        return;
    }

    function local_close {
        if (@Devis_old_dir > 0)
        {
            .dir = @Devis_old_dir;
        }
        npc_resumemove;

        close;
    }

    @Devis_old_dir = -1;

    npc_pausemove;
    face_to_PC;
    say_random_greeting;
    local_close;

OnTimer1000:
    dographmovestep;

OnInit:
    .sex = G_MALE;
    .distance = 5;
    initmovegraph   "start_pos",    193, 109,
                    "dock_ent",     194, 109,
                    "dock_right",   192, 114,   195, 115,
                    "dock_left",    151, 103,   160, 106,
                    "dock_bot",     161, 119,   163, 127,
                    "dock_top",     184, 91,    195, 92,
                    "ship_ent",     19,  28,
                    "ship_sit",     28,  26,
                    "dock_mid",     174, 105;

    setmovegraphcmd "start_pos",    "dock_mid",     1,  "dir 0; wait 2",
                    "dock_ent",     "dock_right",   1,  "dir 0; wait 1; dir 2; wait 1; dir 0; wait 1; dir 6; wait 5",
                    "dock_ent",     "dock_mid",     2,  "moveon",
                    "dock_bot",     "dock_left",    1,  "dir 6; wait 8",
                    "dock_bot",     "dock_mid",     2,  "moveon",
                    "dock_left",    "dock_bot",     1,  "dir 0; wait 1; dir 2; wait 1; dir 0; wait 1; dir 6; wait 5",
                    "dock_left",    "dock_mid",     2,  "moveon",
                    "dock_right",   "dock_ent",     1,  "warp 001-2-21 ship_ent",
                    "dock_right",   "dock_mid",     2,  "moveon",
                    "dock_top",     "dock_mid",     1,  "moveon",
                    "dock_mid",     "dock_bot",     1,  "dir 0; wait 1; dir 2; wait 1; dir 0; wait 1; dir 6; wait 5",
                    "dock_mid",     "dock_right",   1,  "dir 0; wait 1; dir 2; wait 1; dir 0; wait 1; dir 6; wait 5",
                    "dock_mid",     "dock_left",    1,  "dir 0; wait 1; dir 2; wait 1; dir 0; wait 1; dir 6; wait 5",
                    "dock_mid",     "dock_top",     1,  "dir 0; wait 1; dir 2; wait 1; dir 0; wait 1; dir 6; wait 5",
                    "dock_mid",     "dock_ent",     2,  "warp 001-2-21 ship_ent",
                    "ship_ent",     "ship_sit",     1,  "dir 4; sit; wait 14; stand; wait 1",
                    "ship_sit",     "ship_ent",     1,  "warp 001-1 dock_ent";

    firstmove "wait 8", "start_pos";
    initnpctimer;
}

